#[flutter_rust_bridge::frb(sync)] // Synchronous mode for simplicity of the demo
pub fn greet(name: String) -> String {
    format!("Hello, {name}!")
}

/// 过滤文件
#[flutter_rust_bridge::frb(sync)]
pub fn search_file(list: Vec<String>, key: String) -> Vec<String> {
    // 预开辟空间
    let mut result = Vec::with_capacity(list.len());

    for file_name in list {
        if file_name.contains(key.as_str()) {
            result.push(file_name);
        }
    }

    // list.iter()
    //     .filter(|file_name| file_name.contains(key.as_str()))
    //     .collect::<Vec<String>>()

    result
}

#[flutter_rust_bridge::frb(init)]
pub fn init_app() {
    // Default utilities - feel free to customize
    flutter_rust_bridge::setup_default_user_utils();
}
